import store from '@/store/index.js'

export const loginRouter = (path) => {
	if (loginVerify()) {
		if (path) {
			uni.navigateTo({
				url: path
			})
		}
	}
}

export const loginVerify = () => {
	if (store.state.vuex_user) {
		return true
	}
	uni.showModal({
		title: '提示',
		content: '该操作需要先登录哦',
		confirmText: '登录',
		success: function(res) {
			if (res.confirm) {
				uni.navigateTo({
					url: "/pageA/login/login",
					animationType: 'zoom-fade-out',
					animationDuration: 300
				})
			}
		}
	})

	return false
}